// Copyright (C) <2018> Zealcomm Inc.
//
// SPDX-License-Identifier: Apache-2.0
#import <Foundation/Foundation.h>
#import <WebRTC/RTCMacros.h>
#import <WebRTC/RTCLegacyStatsReport.h>
#import <IRTC/IRTCMediaFormat.h>
NS_ASSUME_NONNULL_BEGIN
@class IRTCConferencePublication;
RTC_EXPORT
@protocol IRTCConferencePublicationDelegate <NSObject>
@optional
/// Publication is ended.<br>发布结束。
- (void)publicationDidEnd:(IRTCConferencePublication*)publication;
/// Publication is muted. Client stopped sending audio and/or video data to remote endpoint.<br>发布静默。客户端停止发送音频（视频）数据到远端。
- (void)publicationDidMute:(IRTCConferencePublication*)publication
                  trackKind:(IRTCTrackKind)kind;
/// Publication is unmuted. Client continued sending audio and/or video data to remote endpoint.<br>发布继续。客户端继续发送音频（视频）数据到远端。
- (void)publicationDidUnmute:(IRTCConferencePublication*)publication
                    trackKind:(IRTCTrackKind)kind;
@end
/**
  @brief Publication represents a sender for publishing a stream.<br>发布表示一个流发送者发布一条音视频流。
  @details It handles the actions on a LocalStream published to a conference.<br>发布表示一个流发送者发布一条音视频流。
*/
RTC_EXPORT
@interface IRTCConferencePublication : NSObject
- (instancetype)init NS_UNAVAILABLE;
/// Stop certain publication. Once a subscription is stopped, it cannot be recovered.<br>停止某个发布。一旦某个发布被停止，它将不能被恢复。
- (void)stop;
/// Stop sending data to remote endpoint.<br>停止向远端发送数据流。
- (void)mute:(IRTCTrackKind)trackKind
    onSuccess:(nullable void (^)())onSuccess
    onFailure:(nullable void (^)(NSError*))onFailure;
/// Continue sending data to remote endpoint.<br>继续向远端发送数据流。
- (void)unmute:(IRTCTrackKind)trackKind
     onSuccess:(nullable void (^)())onSuccess
     onFailure:(nullable void (^)(NSError*))onFailure;
/// Get stats of underlying PeerConnection.<br>获取当前PeerConnection的状态数据。
- (void)statsWithOnSuccess:(void (^)(NSArray<RTCLegacyStatsReport*>*))onSuccess
                 onFailure:(nullable void (^)(NSError*))onFailure;
@property(nonatomic, strong, readonly) NSString* publicationId;
@property(nonatomic, weak) id<IRTCConferencePublicationDelegate> delegate;
@end
NS_ASSUME_NONNULL_END
